#include "Interactiv_BIM/Interactiv_BIMPublic.h"

#include "Datas/DatasPublic.h"


KaiMenCommand::KaiMenCommand(Interactiv_Base* bim_Interactiv, int type) : ChaiDanCommand(bim_Interactiv, type)
{

}


bool KaiMenCommand::commandEnd()
{
	/*osg::BoundingBox box;
	OSGChaiDanTool::searchRectangularArea(m_release_point, m_push_point, box);*/

	/*box.mCenter[2] = 1550;
	box.getBoxFromCLWH();

	OcDbObjectId id = ChaiDanDataBase::Tr_AddData(&CDateKaiMen(box));
	state_ = 0;

	g_pInteractivBIM->createDragGeodeAndEditNum(id);
*/
	bool isDraw = l >= 200 && w >= 100;

	if (l < 18 || w < 18 || isDraw)
	{
		return false;
	}
	CDateKaiMen door;
	osg::BoundingBox area, doorBox;
	OSGChaiDanTool::searchRectangularArea(m_release_point, m_push_point, area);
	area.getBoxFromCLWH();
	//SimpleAlgorithTool::GeneratorDoorByArea(door, area);
	door.GeneratorByArea(area);
	// doorBox = osg::BoundingBox(area.center() + osg::Vec3f(0, 0, area.mDepth / 2 + 9),
	// 	area.mWidth - door.mLeftChink - door.mRightChink,
	// 	area.mHeight - door.mTopChink - door.mBottomChink,
	// 	18);
	// doorBox.getBoxFromCLWH();
	// doorBox.mTextIDTotal = texture_diban;
	// doorBox.mTextID[4] = texture_kaimen_left;
	// // door.mBox = doorBox;
	// door.mBoxes.push_back(doorBox);
	// door.mTextIdTotal = texture_diban;
	ChaiDanDataBase::Tr_AddData(&door);
	return true;
}
